#!/usr/bin/python3

colnum = 60
startInfo = '#'*colnum + '\n'
infos = ["## Tool python3.9 support.",
         "## Author: xuebao.",
         "## Date: 2025/03/05",
         "## Function: create new module.",
         "## Description: './autoedit.py' to start tool"]
for line in infos:
    startInfo += line
    startInfo += ' '*(colnum-len(line)-2)
    startInfo += '##\n'
startInfo += '#'*colnum

fileDesc = '/' + '*'*(colnum-1) + '\n'
filedesc = ["* Filename: %s",
            "* Description: %s",
            "* Author: %s",
            "* Date: %s"]
for line in filedesc:
    fileDesc += line
    fileDesc += '\n'
fileDesc += '*'*(colnum-1)
fileDesc += '/\n'

funcDesc = '/' + '*'*(colnum-1) + '\n'
funcdesc = ["* Function: %s",
            "* Description: %s",
            "* params: %s",
            "* return: %s",
            "* Author: %s",
            "* Date: %s"]
for line in funcdesc:
    funcDesc += line
    funcDesc += '\n'
funcDesc += '*'*(colnum-1)
funcDesc += '/\n'

makefile = """CC := gcc
CFLAGS := -Iinc -Wall -Wextra -O2
SRC_DIRS := src
OBJ_DIR := obj
LDFLAGS =

# 自动发现源文件
SRC := $(shell find $(SRC_DIRS) -name '*.c')
OBJ = $(addprefix $(OBJ_DIR)/,$(notdir $(SRC:.c=.o)))
TARGET := $(OBJ_DIR)/%s
DEPS = $(OBJECTS:.o=.d)

# VPATH for source lookup
VPATH = $(SRC_DIRS)

# Default target
all: $(TARGET)

# 链接阶段
$(TARGET): $(OBJ) | obj
	$(CC) $(LDFLAGS) $^ -o $@

# 编译规则（保留目录结构）
$(OBJ_DIR)/%%.o: %%.c | obj
	$(CC) $(CFLAGS) -c $< -o $@

# Create build directory
obj:
	mkdir -p $@

# Include dependencies
-include $(DEPS)

# Clean
.PHONY: clean
clean:
	rm -rf $(TARGET) $(OBJ) $(DEPS)

# Help
.PHONY: help
help:
	@echo "Usage:"
	@echo "  make     - build project"
	@echo "  make clean - remove build artifacts"

"""
